#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "logger.h"
#include "str.h"

#define FILE_MODE   (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) 

int main(int argc ,char * argv[])
{
   //FATAL("de:%d",2); 
   set_log_level(LOGL_DEBUG);
   DEBUG("de2:%d",2); 
   INFO("de2:%d",2); 

   char * name = "mypro";
    
   int  n = strlen(argv[0]); 
   char *p = argv[0]; 
   int i;
   for(i=0;i<n;i++){
      *p++ = *(name+i);
   }
   
   int fd = open("./log",O_WRONLY|O_CREAT|O_APPEND,FILE_MODE);
   //int fd = open("./log",O_CREAT,FILE_MODE);
   if(fd < 0 )  FATAL("open error ");
   //set_log_fd(fd);
   INFO("open successed  :%s",argv[0]);
   INFO("open successed");
   INFO("open successed");
   INFO("open successed");
   INFO("open successed");
   INFO("open successed");
   //pause();

   char dst[100] = {'\0'};
   encode_base64(dst,"hello",5);
   INFO("encode base64: %s",dst);
   
   char dst2[100] = {'\0'};
   decode_base64(dst2,dst);
   INFO("decode base64: %s",dst2);
   
   close(fd);
   return 0;
}
